﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Bigger.Base.Pipeline;
using Bigger.Framework;

namespace Bigger.Study.Web.Controllers
{
    public class ApiTestController : StudyController
    {
        public ActionResult MvcApiTest()
        {
            return View();
        }

        [HttpGet]
        public ActionResult GetApiResultFromPage(ApiPackage objApiPackage)
        {
            return View(objApiPackage);
        }

        public ActionResult EditCourse()
        {
            return View();
        }

        [HttpPost]
        public ActionResult AddCourse(ApiPackage objApiPackage)
        {
            return View(objApiPackage);
            InvokeResult objInvokeResult = CheckApiPackageHandler.CheckApiPackage(objApiPackage);
            if (objInvokeResult.ResultCode != "Success")
            {
                return Json(objInvokeResult);
            }
            objInvokeResult.Data = null;
            string CourseTitle = objApiPackage.DbParameters.GetDictValue("CourseTitle");
            if (CourseTitle.IsNull())
            {
                objInvokeResult.ResultCode = "CourseTitleNull";
                objInvokeResult.ResultMessage = "对不起，请输入课程标题";
                return Json(objInvokeResult);
            }
            //todo：其他验证等等
            //return ApiProcessPost(objApiPackage);
            return ApiMessageConfig(objApiPackage, "MvcApiMessagePost");
        }

        public ActionResult WebApiApiTest()
        {
            return View();
        }
    }
}
